import 'package:lib_core/const/net_cst.dart';
import 'package:lib_core/lib_core.dart';
import 'package:lib_core/net/dio_client.dart';

part 'user_client.g.dart';

@RestApi()
abstract class UserClient {
  factory UserClient({Dio? dio}) {
    dio ??= DioClient.dio;
    return _UserClient(dio, baseUrl: NetCst().hostUrl);
  }

  @POST('user/login')
  Future<Rsp<UserModel>> loginPwd(@Query('username') String username, @Query('password') String password);

  @POST('user/register')
  Future<Rsp<UserModel>> register(@Query('username') String username, @Query('password') String password, @Query('repassword') String rePassword);

  @GET('user/logout/json')
  Future<Rsp> logout();
}
